﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PS_WSSDeploy_Package.Application
{
    public enum SpFileToken
    {
        ProjectAssemblyFullName = 0,
        ProjectAssemblyFileNameWithoutExtension,
        ProjectAssemblyPublicKeyToken,
        FeatureFileName,
        FeatureFileNameWithoutExtension,
        FeatureDeploymentPath,
        FeatureId
    }

    public static class SpFileTokenString
    {
        public const string ProjectAssemblyFullName = "$SharePoint.Project.AssemblyFullName$";
        public const string ProjectAssemblyFileNameWithoutExtension = "$SharePoint.Project.AssemblyFileNameWithoutExtension$";
        public const string ProjectAssemblyPublicKeyToken = "$SharePoint.Project.AssemblyPublicKeyToken$";
        public const string FeatureFileName = "$SharePoint.Feature.FileName$";
        public const string FeatureFileNameWithoutExtension = "$SharePoint.Feature.FileNameWithoutExtension$";
        public const string FeatureDeploymentPath = "$SharePoint.Feature.DeploymentPath$";
        public const string FeatureId = "$SharePoint.Feature.Id$";

        public static string Get(SpFileToken token)
        {
            switch (token)
            {
                case SpFileToken.ProjectAssemblyFullName:
                    return ProjectAssemblyFullName;
                case SpFileToken.ProjectAssemblyFileNameWithoutExtension:
                    return ProjectAssemblyFileNameWithoutExtension;
                case SpFileToken.ProjectAssemblyPublicKeyToken:
                    return ProjectAssemblyPublicKeyToken;
                case SpFileToken.FeatureFileName:
                    return FeatureFileName;
                case SpFileToken.FeatureFileNameWithoutExtension:
                    return FeatureFileNameWithoutExtension;
                case SpFileToken.FeatureDeploymentPath:
                    return FeatureDeploymentPath;
                case SpFileToken.FeatureId:
                    return FeatureId;
                default:
                    throw new ArgumentException("token");
            }
        }
    }
}
